//
//  CWCVideoCell.m
//  ChuanNews
//
//  Created by dllo on 16/4/16.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CWCVideoCell.h"
#import "BaseHeader.h"
#import "CWCVideoModel.h"


@implementation CWCVideoCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UIView  *line = [[UIView alloc]initWithFrame:CGRectMake(10, 255, WIDTH - 20, 1)];
        [self.contentView addSubview:line];
        [line release];
        line.backgroundColor = [UIColor lightGrayColor];
        
        self.titleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.titleLabel];
        self.titleLabel.font = [UIFont systemFontOfSize:20];
        [_titleLabel release];
        
        self.videosourceLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.videosourceLabel];
        self.videosourceLabel.font = [UIFont systemFontOfSize:11];
        [_videosourceLabel release];
        
        self.descLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.descLabel];
        self.descLabel.font = [UIFont systemFontOfSize:15];
        self.descLabel.textAlignment = NSTextAlignmentLeft;
        [_descLabel release];
        
        self.timeLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.timeLabel];
        self.timeLabel.font = [UIFont systemFontOfSize:11];
        [_timeLabel release];
        
        self.playCountLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.playCountLabel];
        self.playCountLabel.font = [UIFont systemFontOfSize:11];
        [_playCountLabel release];
        
        self.imageCover = [[UIImageView alloc] init];
        [self.contentView addSubview:self.imageCover];
        self.imageCover.userInteractionEnabled = YES;
        [_imageCover release];
        
        self.play = [[UIImageView alloc]init];
        [self.contentView addSubview:self.play];
        [_play release];
        
        [self jxl_setDayMode:^(UIView *view) {
            CWCVideoCell *cell = (CWCVideoCell *)view;
            cell.backgroundColor = [UIColor whiteColor];
            cell.contentView.backgroundColor = [UIColor whiteColor];
            cell.titleLabel.backgroundColor = [UIColor whiteColor];
            cell.titleLabel.textColor = [UIColor blackColor];
            cell.videosourceLabel.backgroundColor = [UIColor whiteColor];
            cell.videosourceLabel.textColor = [UIColor blackColor];
            cell.descLabel.backgroundColor = [UIColor whiteColor];
            cell.descLabel.textColor = [UIColor blackColor];
            cell.timeLabel.backgroundColor = [UIColor whiteColor];
            cell.timeLabel.textColor = [UIColor blackColor];
            cell.playCountLabel.backgroundColor = [UIColor whiteColor];
            cell.playCountLabel.textColor = [UIColor blackColor];
        } nightMode:^(UIView *view) {
            CWCVideoCell *cell = (CWCVideoCell *)view;
            cell.backgroundColor = [UIColor blackColor];
            cell.contentView.backgroundColor = [UIColor blackColor];
            cell.titleLabel.backgroundColor = [UIColor blackColor];
            cell.titleLabel.textColor = [UIColor whiteColor];
            cell.videosourceLabel.backgroundColor = [UIColor blackColor];
            cell.videosourceLabel.textColor = [UIColor whiteColor];
            cell.descLabel.backgroundColor = [UIColor blackColor];
            cell.descLabel.textColor = [UIColor whiteColor];
            cell.timeLabel.backgroundColor = [UIColor blackColor];
            cell.timeLabel.textColor = [UIColor whiteColor];
            cell.playCountLabel.backgroundColor = [UIColor blackColor];
            cell.playCountLabel.textColor = [UIColor whiteColor];        }];
 
    }
    
    
    return self;
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    self.titleLabel.frame = CGRectMake(20, 190, 320, 50);
    self.videosourceLabel.frame = CGRectMake(325, 262, 50, 30);
    self.descLabel.frame = CGRectMake(20, 230, WIDTH - 20, 20);
    self.timeLabel.frame = CGRectMake(20, 260, 100, 20);
    self.playCountLabel.frame = CGRectMake(120, 260, 80, 20);
    self.imageCover.frame = CGRectMake(0, 10, WIDTH, 180);
    self.play.frame = CGRectMake(WIDTH / 2 - 15, 105, 30, 30);
}






/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
